package controllers

import (
	beego "github.com/beego/beego/v2/server/web"
	"user/utils"
)

type SendGbController struct {
	beego.Controller
}

func (c *SendGbController) SendGb() {
	userid := c.GetString("userid")
	content := c.GetString("content")
	//uid, _ := strconv.Atoi(userid)
	//token := c.GetString("token")
	//id, t := utils.ParseToken(token)
	//fmt.Println(id)
	//if id != uid && time.Now().Unix() > t {
	//	c.Data["json"] = map[string]interface{}{
	//		"code":    http.StatusCreated,
	//		"message": "请先登录",
	//	}
	//	c.ServeJSON()
	//	return
	//}
	rabbit := utils.NewRabbitMQPubSub("" + "Gb")
	//发送消息
	rabbit.PublishPub(content + "_" + userid)
}
